package com.liebaut.util;


import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.session.HashSessionIdManager;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import java.lang.management.ManagementFactory;
import java.util.Random;

public class LiebautStarter {

    private static final Logger log = LoggerFactory.getLogger(LiebautStarter.class);

    public static void main(String[] args) throws Exception {
        log.error("error");
        log.debug("test");
        log.info("info");
        log.warn("warn");
        System.out.println(log.isDebugEnabled());

//        String webapp = args[0];
//        System.err.println("Webapp folder: " + webapp);
//
//        Server server = new Server(8080);
//        System.out.println("Starting context");
//        WebAppContext context = new WebAppContext();
//        context.setDescriptor(webapp + "/WEB-INF/web.xml");
//        context.setResourceBase(webapp);
//        context.setContextPath("/LiebautServer");
//        context.setParentLoaderPriority(true);
//
//        server.setHandler(context);
//        System.out.println("Starting server");
//        server.start();
//        System.out.println("Server Join");
//        server.join();
//        System.out.println("Server started");

          Server server = new Server(8080);
//        MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
//        server.addBean(mbContainer);



        System.out.println("Starting server");
        server.start();
        System.out.println("Server Join");
        server.join();
        System.out.println("Server started");
    }
}
